﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPSC481
{
    class ReadFile
    {

  
        public static String[] read(String fileName)
        {
            // The files used in this example are created in the topic 
            // How to: Write to a Text File. You can change the path and 
            // file name to substitute text files of your own. 

            // Example #1 
            // Read the file as one string. 
            String filePath = System.IO.Path.GetFullPath(Directory.GetCurrentDirectory() + @"\recipes\" + fileName);
            //string text = System.IO.File.ReadAllText(@"C:\Users\Public\TestFolder\WriteText.txt");

            // Display the file contents to the console. Variable text is a string.
            //System.Console.WriteLine("Contents of WriteText.txt = {0}", filePath);

            // Example #2 
            // Read each line of the file into a string array. Each element 
            // of the array is one line of the file. 
            String[] lines = System.IO.File.ReadAllLines(filePath);

            //foreach (String line in lines)
            //{
            //    // Use a tab to indent each line of the file.
            //    Console.WriteLine("\t" + line);
            //}

            return lines;
        }
    }
}
